from pymysql import connect

import sys
sys.path.append("..")
from config.createTable import CreatePythonTable

mysql_info = {
    "host": "localhost",
    "user": "root",
    "passwd":"123456",
}

db = connect(**mysql_info)


cursor = db.cursor()

# 确保 python 数据库不存在
cursor.execute("drop database if exists `python`;")
# 创建 python 数据库
cursor.execute("create database `python` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;")
# 使用 python 数据库
cursor.execute("use python;")
# 创建 zongheng 表
cursor.execute(CreatePythonTable)
db.commit()



